package com.example.liang.basamovie.json;
import com.example.liang.basamovie.bean.Recommend3;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
//轮播图片的json解析
public class RecommendJson2 {
    public static List<Object> getRecommend2(String info){
        try {
            JSONObject object = new JSONObject(info);
            JSONArray array7 = object.getJSONArray("forcusImageList");
            List<Object> list=new ArrayList<>();
            List<String> bannerList = new ArrayList<>();
            List<String> maintitleList = new ArrayList<>();
            List<String> subtitleList = new ArrayList<>();
            for (int i = 0; i < 5; i++) {
                JSONObject object7 = array7.getJSONObject(i);
                Recommend3 recommend3 = new Recommend3();
                String imgUrl = object7.optString("imageUrl");
                String maintitle=object7.optString("mainTitle");
                String subtitle=object7.optString("subTitle");
                bannerList.add(imgUrl);
                maintitleList.add(maintitle);
                subtitleList.add(subtitle);
                recommend3.setData(bannerList);
                recommend3.setData1(maintitleList);
                recommend3.setData2(subtitleList);
                list.add(recommend3);
            }
            return list;
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return null;
    }

}
